package cn.thornbird.orgsync.entity;

import cn.thornbird.orgsync.entity.status.UserType;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.hibernate.annotations.Where;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Entity
@Table(name = "users")
@Where(clause = "deleted_at is null")
public class User extends BaseEntity implements Serializable {

    private static final long serialVersionUID = -2169164489523129669L;

    @Column(name = "username")
    private String username;

    @Column(name = "password")
    private String password;

    @Column(name = "avatar")
    private String avatar;

    @Column(name = "superuser")
    private Boolean superuser;

    @Column(name = "type")
    private UserType type;

    @Column(name = "active")
    private Boolean active;

    @Column(name = "locked")
    private Boolean locked;

    @Column(name = "effective_date")
    private Date effectiveDate;

    @Column(name = "terminate_date")
    private Date terminateDate;

    @Column(name = "need_change_password")
    private Boolean needChangePassword;

    @Column(name = "password_terminate_date")
    private Date passwordTerminateDate;

    @Column(name = "failed_login_attempts")
    private Short failedLoginAttempts;

    @Column(name = "last_login_time")
    private Date lastLoginTime;

    @Column(name = "last_login_ip")
    private String lastLoginIp;

    @Column(name = "name")
    private String name;

    @Column(name = "company")
    private String company;

    @Column(name = "department")
    private String department;

    @Column(name = "title")
    private String title;

    @Column(name = "email")
    private String email;

    @Column(name = "mobile")
    private String mobile;

    @Column(name = "telephone")
    private String telephone;

    @Column(name = "authorized_opinions")
    private String authorizedOpinions;

    @Column(name = "remark")
    private String remark;

}
